<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of class
 *
 * @author Administrator
 */
class LeaveMessage {

    public $smarty = null;

    public function __construct() {
        include_once($_SERVER['DOCUMENT_ROOT'] . "/RecJP/class/class.SqliteHelper.php");
        include_once($_SERVER['DOCUMENT_ROOT'] . "/RecJP/class/Model/Model.leaveMessage.php");
        include_once($_SERVER['DOCUMENT_ROOT'] . "/RecJP/class/DAL/DAL.LeaveMessage.php");
        include_once($_SERVER['DOCUMENT_ROOT'] . "/RecJP/inc/smarty_inc.php");
        $this->smarty = getSmarty();
        $this->s = new SqliteHelper();
    }

    public function insertMessage($leaveMessage) {
        try {
            DAL_LeaveMessage::insertMessage($leaveMessage);
            return 0;
        } catch (Exception $e) {
            return $e->getMessage();
        }
    }

    public function getMessage() {
        try {
            $r = DAL_LeaveMessage::GetMessageList();
            return $r;
        } catch (Exception $e) {
            return $e->getMessage();
        }
    }

    public function show() {
        $Message = $this->getMessage();
        $this->smarty->assign("Message", $Message);
        $this->smarty->display('LeaveMessage.tpl.htm');
    }

}

?>
